package com.challenge.util;

public class FormateString {

    public static String padRight(String orgStr,int len,String aliStr){
        if(orgStr==null || orgStr.length()>=len){
            return orgStr;
        }

        int length=0;
        StringBuffer res=new StringBuffer();
        StringBuffer bf=new StringBuffer(orgStr);
        for(int i=0;i<orgStr.length();i++){
            int ASCII=Character.codePointAt(orgStr,i);
            if(ASCII>=0 && ASCII<=255){
                length++;
            }else{
                length+=2;
            }
        }

        for(int j=0;j<len-orgStr.length();j++){
            res=bf.append(aliStr);
        }
        return res.toString();
    }

}
